//整个项目的路由器
import VueRouter from "vue-router";
//引入组件

import Register from "@/pages/Register";
import Login from "@/pages/Login";
import Index from "@/components/Index";
import Home from "@/pages/Home";
import Info from "@/pages/Info";
import ModifyInfo from "@/pages/ModifyInfo";
import QueryDorm from "@/pages/QueryDorm";
import SelectDorm from "@/pages/SelectDorm";
import Result from "@/pages/Result";

//创建并暴露一个路由器
export default new VueRouter({
    mode: "history",
    routes:[
        {
            name: 'index',
            path: '/',
            component: Index,
            // children:[
            //     {
            //         path: 'user/register',
            //         component: Register,
            //     },
            //     {
            //         path: 'user/login',
            //         component: Login,
            //     },
            // ],
        },
        {
            name: 'register',
            path: '/register',
            component: Register,
        },
        {
            name: 'login',
            path: '/login',
            component: Login,
        },
        {
            name: 'home',
            path: '/home',
            component: Home,
            children: [
                {
                    name: 'info',
                    path: 'info',
                    component: Info,
                },
                {
                    name: 'modifyInfo',
                    path: 'modifyInfo',
                    component: ModifyInfo,
                },
                {
                    name: 'queryDorm',
                    path: 'queryDorm',
                    component: QueryDorm,
                },
                {
                    name: 'selectDorm',
                    path: 'selectDorm',
                    component: SelectDorm,
                },
                {
                    name: 'result',
                    path: 'result',
                    component: Result,
                },
            ]
        },
    ]
})